<?php

namespace App\Http\Controllers\Admin\System;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\System\Config;

class ConfigController extends Controller
{
    public function __construct()
    {
        view()->share([
            '_system' => 'active open',
            '_config' => 'active',
        ]);
    }


    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $config = Config::find(1);
        return view('admin.system.config.index', compact('config'));
    }



    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request)
    {
        $config = Config::find(1);
        $config->update($request->all());
        return back()->with('success', '更新系统设置成功~');
    }

}
